package csc.fresher.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import csc.fresher.dao.DepositAccountDao;
import csc.fresher.dao.SavingAccountDao;
import csc.fresher.entity.DepositAccount;
import csc.fresher.entity.SavingAccount;
import csc.fresher.service.ApproveAccountService;

@Service
public class ApproveAccountServiceImpl implements ApproveAccountService {

	@Autowired
	private DepositAccountDao depositAccountDao;
	
	@Autowired
	private SavingAccountDao savingAccountDao;
	
	@Override
	public boolean approveDepositAccount(DepositAccount depositAccount) {
		return depositAccountDao.updateStateToActive(depositAccount);
	
	}
	
	@Override
	public boolean approveNewSavingAccount(SavingAccount savingAccount) {
		return savingAccountDao.approveAccount(savingAccount);
	}
	
	@Override
	public boolean approveSavingAccount(SavingAccount savingAccount) {
		return savingAccountDao.updateStateToActive(savingAccount);
	}
	
	@Override
	public void changeSavingAccountStateToDisable(SavingAccount savingAccount){
		savingAccountDao.updateStateToDisable(savingAccount);
	}
	
	@Override
	public void changeSavingAccountStateToRemovable(SavingAccount savingAccount){
		savingAccountDao.updateStateToRemovable(savingAccount);
	}
	
	@Override
	public void changeDepositAccountStateToDisable (DepositAccount depositAccount){
		depositAccountDao.updateStateToDisable(depositAccount);
	}
	
	@Override
	public void changeDepositAccountStateToRemovable(DepositAccount depositAccount){
		depositAccountDao.updateStateToRemovable(depositAccount);
	}
	
	@Override
	public void changeDepositAccountStateToRemoved(DepositAccount depositAccount){
		depositAccountDao.updateStateToRemoved(depositAccount);
	}
	
	@Override
	public void changeSavingAccountStateToRemoved(SavingAccount savingAccount){
		savingAccountDao.updateStateToRemoved(savingAccount);
	}
}
